$(document).ready(function(){

   var errorValidator = $("#addErrorReportForm").validate({

        rules: {      
            errorName: { required: true, maxlength: 30 },
            errorEmail: { required: true, email: true, maxlength: 30},
            errorDescription: { required: true , maxlength: 1000}
               
         },
         messages: {
            errorName: { required:"需要输入用户名", maxlength:'最多输入30个字符'},        
            errorEmail: {required:"需要输入邮箱", email:"邮箱格式不正确", maxlength:'最多输入30个字符'},
            errorDescription: { required:"需要输入说明，1-1000字", maxlength:'最多输入1000个字符'}                 
         },
         submitHandler: function() {
        	 return true;        	 
         }
     });

   $("#submitErrorReportBtn").click(function() {
     
     if(errorValidator.form()){
       
      var params = $("#addErrorReportForm").serializeArray();
  
      $.ajax({
                type: 'post',
                url: edp_domain_url + 'ajax_error_report/?tiny=2',
                data: params,
				timeout: 5000,
				global:false,
	            beforeSend: function(){
				
				},
				error: function(){
				
				$("#addErrorReportBox").html('发送失败...');

				},
                success: function(){
				 $("#addErrorReportBox").html('发送成功，感谢您对花开里的支持。<br>我们会在两个工作日内处理您的意见或建议。<br> 由于反馈众多，可能无法逐一回复，请见谅。 ');    
                },
                complete: function(){

                }
            });
        }    
   });

});



 